package com.itgone;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.extra.ftp.SimpleFtpServer;

/**
 * mvn clean package
 * java -DrootDir=E:/temp -jar target/SimpleFtpServer-1.0-SNAPSHOT-jar-with-dependencies.jar
 */
public class Main {
    public static void main(String[] args) {
        String rootDir = System.getProperty("rootDir");
        if (rootDir == null || rootDir.trim().length() == 0) {
            rootDir = "./ftp";
        }

        FileUtil.mkdir(rootDir);

        SimpleFtpServer
                .create()
                .addAnonymous(rootDir)
                .start();
        Console.log("SimpleFtpServer running at  {}.", rootDir);
    }
}